/*
 * @Author: 张小平
 * @Date:   2025-05-01
 * @Email:  qqshuqian@163.com
 * @Copyright © 2024 aseyun. All rights reserved.
 */
import request from '@/framework-core/axios';
import website from '@/framework-core/config/website';

/**
 * 分页查询
 * @param path
 * @param query 查询条件
 */
export function pageCore(path, query) {

    return request({
        url: website.baseUrl + '/api/' + path + '/page',
        method: 'post',
        data: query
    })
}

/**
 * 查询
 * @param path
 * @param query 查询条件
 */
export function listCore(path, query) {
    return request({
        url: website.baseUrl + '/api/' + path + '/list',
        method: 'post',
        data: query
    })
}

/**
 * 单个查询
 * @param path
 * @param id
 */
export function getCore(path, id, params) {
    return request({
        url: website.baseUrl + '/api/' + path + '/get?id=' + id,
        params: params,
        method: 'get'
    })
}

/**
 * 保存
 * @param path
 * @param obj
 */
export function saveCore(path, obj, params) {
    return request({
        url: website.baseUrl + '/api/' + path + '/save',
        method: 'post',
        data: obj,
        params: params
    })
}


/**
 * 删除
 * @param path
 * @param row
 */
export function delCore(path, row, params) {
    return request({
        url: website.baseUrl + '/api/' + path + '/delete?id=' + row.id,
        method: 'post',
        params: params
    })
}

/**
 * 批量删除
 * @param path
 * @param row
 */
export function delsCore(path, data, params) {
    return request({
        url: website.baseUrl + '/api/' + path + '/deletes',
        method: 'post',
        data: data
    })
}


/**
 * 导入
 * @param path
 */
export function importCore(path, data, params) {
    return request({
        url: website.baseUrl + '/api/' + path + '/import',
        method: 'post',
        data: data,
        params: params
    })
}


/**
 * 导出
 * @param path
 * @param query 查询条件
 */
export function exportCore(path, query, params) {
    return request({
        url: website.baseUrl + '/api/' + path + '/export',
        method: 'post',
        data: query,
        params: params
    })
}

/**
 * 下载
 * @param path
 */
export function downloadCore(path, type, fileName) {
    return website.baseUrl + '/api/' + path + '/download?type=' + type + "&fileName=" + fileName
}
